package com.ssm.controller;

import com.ssm.po.Task;
import com.ssm.po.TaskInfo;
import com.ssm.service.TaskInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;


@Controller
public class TaskInfoController {



    @Autowired
    TaskInfoService taskInfoService;

    /**
     * 查看时间轴信息
     * @param taskId 任务id
     * @return
     */
    @RequestMapping("getTaskInfo.do")
    @ResponseBody
    public TaskInfo getTaskInfo(int taskId){
        return taskInfoService.getTaskInfo(taskId);
    }

    /**
     * 设置预计需要时间
     * @param taskId 任务id
     * @param aboutUse 大约需要的时间
     */
    @RequestMapping("aboutUse.do")
    public void aboutUse(int taskId,String aboutUse){
        taskInfoService.aboutUse(taskId,aboutUse);
    }

    /**
     * 订单完成后用户给出的评价
     * @param taskId  任务ID
     * @param evaluateScore 评论分数
     * @param evaluate 给出的评论
     */
    @RequestMapping("evaluate.do")
    public void evaluate(int taskId,String evaluateScore,String evaluate){
        taskInfoService.evaluate(taskId,evaluateScore,evaluate);
    }

    /**
     * 查看所有接收订单的ID
     */
    @RequestMapping(value="findAccept.do",produces="application/json")
    @ResponseBody
    public Object findAccept(int userId){
        return taskInfoService.findAccept(userId);
    }

    /**
     * 查看此人所有发出去的订单信息
     * @param userId
     * @return
     */
    @RequestMapping(value="findOrder.do" ,produces="application/json")
    @ResponseBody
    public Object findOrder(int userId){
        return taskInfoService.findOrder(userId);
    }

}
